/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ep.persistence.entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Spyros
 */
@Entity
@Table(name = "t008_dosage", catalog = "epresc", schema = "")
@NamedQueries({
    @NamedQuery(name = "T008Dosage.findAll", query = "SELECT t FROM T008Dosage t"),
    @NamedQuery(name = "T008Dosage.findById", query = "SELECT t FROM T008Dosage t WHERE t.id = :id"),
    @NamedQuery(name = "T008Dosage.findByDuration", query = "SELECT t FROM T008Dosage t WHERE t.duration = :duration"),
    @NamedQuery(name = "T008Dosage.findByWayOfInput", query = "SELECT t FROM T008Dosage t WHERE t.wayOfInput = :wayOfInput"),
    @NamedQuery(name = "T008Dosage.findByQuantity", query = "SELECT t FROM T008Dosage t WHERE t.quantity = :quantity"),
    @NamedQuery(name = "T008Dosage.findByPrescribed", query = "SELECT t FROM T008Dosage t WHERE t.prescribed = :prescribed")})
public class T008Dosage implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "duration")
    @Temporal(TemporalType.DATE)
    private Date duration;
    @Column(name = "wayOfInput")
    private String wayOfInput;
    @Column(name = "quantity")
    private Integer quantity;
    @Column(name = "prescribed")
    private Boolean prescribed;
    @JoinColumn(name = "t013_frequency_id", referencedColumnName = "id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private T013Frequency t013Frequency;
    @JoinColumn(name = "t009_medicine_id", referencedColumnName = "id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private T009Medicine t009Medicine;
    @JoinColumn(name = "t006_presciption_id", referencedColumnName = "id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private T006Prescription t006Prescription;

    public T008Dosage() {
    }

    public T008Dosage(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getDuration() {
        return duration;
    }

    public void setDuration(Date duration) {
        this.duration = duration;
    }

    public String getWayOfInput() {
        return wayOfInput;
    }

    public void setWayOfInput(String wayOfInput) {
        this.wayOfInput = wayOfInput;
    }

    public Integer getQuantity() {
        return quantity;
    }

    public void setQuantity(Integer quantity) {
        this.quantity = quantity;
    }

    public Boolean getPrescribed() {
        return prescribed;
    }

    public void setPrescribed(Boolean prescribed) {
        this.prescribed = prescribed;
    }

    public T013Frequency getT013Frequency() {
        return t013Frequency;
    }

    public void setT013Frequency(T013Frequency t013Frequency) {
        this.t013Frequency = t013Frequency;
    }

    public T009Medicine getT009Medicine() {
        return t009Medicine;
    }

    public void setT009Medicine(T009Medicine t009Medicine) {
        this.t009Medicine = t009Medicine;
    }

    public T006Prescription getT006Prescription() {
        return t006Prescription;
    }

    public void setT006Prescription(T006Prescription t006Prescription) {
        this.t006Prescription = t006Prescription;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof T008Dosage)) {
            return false;
        }
        T008Dosage other = (T008Dosage) object;
        if ((this.t009Medicine == null && other.t009Medicine != null) || (this.t009Medicine != null && !this.t009Medicine.equals(other.t009Medicine))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ep.persistence.entities.T008Dosage[id=" + id + "]";
    }

}
